package com.kiln.juxingqs.ui

import android.content.Intent
import android.content.pm.PackageManager
import client.global.commlib.base.FinishReciver
import client.global.commlib.utils.SharedUtil
import client.global.commlib.utils.StoreUtil
import com.kiln.juxingqs.R
import com.kiln.juxingqs.databinding.ActivitySettingBinding
import com.kiln.juxingqs.ui.vm.SettingViewModel
import com.kiln.juxingqs.BaseMiddleActivity
import com.kiln.juxingqs.api.bean.UserInfo
import com.kiln.juxingqs.databinding.ActivitySafeBinding
import com.kiln.juxingqs.dialog.MsgTitleDialog
import com.kiln.juxingqs.ui.safe.UpdatePhoneActivity
import com.kiln.juxingqs.ui.safe.UpdateSystemInfoActivity

class AccountSafeActivity : BaseMiddleActivity<SettingViewModel, ActivitySafeBinding>() {

    var phone: String = ""

    override fun getLayout(): Int {
        return R.layout.activity_safe
    }

    override fun initViewModel(): SettingViewModel = createViewModel()

    override fun initView() {
        binding.event = this
        binding.vm = viewModel
    }

    override fun initData() {
        StoreUtil.getBean<UserInfo>(this)?.let {
            phone = it.phone

        }
    }

    fun updatePhone() {
        startActivity(Intent(this, UpdatePhoneActivity::class.java).apply {
            putExtra("filed", phone)
        })

    }

    fun onEditSystemInfo(type: Int) {
        startActivity(Intent(this, UpdateSystemInfoActivity::class.java).apply {
            putExtra("filed", phone)
            putExtra("type", type)
        })
    }

}